<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\Resource;
use App\User;


class ShopCoupon extends Resource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        if($this->user_id){
            $user = User::find($this->user_id);
        }
        
        return [
            "id"=>$this->id,
            "user_id"=> $this->user_id,
            "name"=> $this->name,
            "send_type"=> $this->send_type,
            "rule"=> $this->rule,
            "max_amount"=> $this->max_amount,
            "expire_time"=>$this->expire_time,
            "store_id"=>$this->store_id,
            "pic_url"=>$this->pic_url
        ];
    }

}
